/**
 * 
 */
package it.unical.canonaco.rende.igpe.game.cbv.guilayer.match;

/**
 * @author Massimo Canonaco
 *
 */
public class UtilityCircle 
{
	private int centerRow;
	private int centerColumn;
	
	private float radius;
	private float radius2;

	/**
	 * @return the centerRow
	 */
	public int getCenterRow() {
		return centerRow;
	}

	/**
	 * @param centerRow the centerRow to set
	 */
	public void setCenterRow(int centerRow) {
		this.centerRow = centerRow;
	}

	/**
	 * @return the centerColumn
	 */
	public int getCenterColumn() {
		return centerColumn;
	}

	/**
	 * @param centerColumn the centerColumn to set
	 */
	public void setCenterColumn(int centerColumn) {
		this.centerColumn = centerColumn;
	}

	/**
	 * @return the radius
	 */
	public float getRadius() {
		return radius;
	}

	/**
	 * @param radius the radius to set
	 */
	public void setRadius(float radius) {
		System.out.println("IMPOSTO RAGGIO "+radius);
		this.radius = radius;
		radius2 = radius*radius;
//		System.out.println("RAGGIO UTILITY 2"+radius+" = "+radius2);
	}
	
	public boolean inside(int x, int y)
	{
		int xD = centerRow - x, yD = centerColumn - y;
		boolean b = (xD*xD) + (yD*yD) <= radius2;
//		System.out.println("utility inside "+x+" "+y+"  "+b);
		return (xD*xD) + (yD*yD) <= radius2;
	}
}
